﻿<%@ Page Title="" Language="C#" MasterPageFile="../Shared/Master.Master" Inherits="System.Web.Mvc.ViewPage<List<EClassify>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <ul class="treeContent">
        <li>
            <div>
                <input type="button" value="增加新分类" onclick="Edit(0)" />
            </div>
        </li>
        <li>
            <ul id="classify" class="classify filetree">
                <%=ClassifyExtend.ClassTree(Model as List<EClassify>)  %>
            </ul>
        </li>
        <li>
            <div>
                <input type="button" value="增加新分类" onclick="Edit(0);" />
            </div>
        </li>
    </ul>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cssLink" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="jsLink" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="cssContent" runat="server">
    <style type="text/css">
        .treeContent, .classify
        {
            padding: 20px;
            overflow: hidden;
        }
        .treeContent li, .classify li
        {
            overflow: hidden;
        }
    </style>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="jsContent" runat="server">
    <script type="text/javascript">
        var moduleKey = '<%= ViewData["ModuleKey"] %>';
        //编辑分类
        function Edit(classifyId) {
            $.get('<%=Url.Action("Classify") %>', { "classifyId": classifyId, 'moduleKey': moduleKey, "rnd": Math.random() },
            function (result) {
                result = $(result);
                result.find("form").ajaxForm({ success: function () { location.reload(); } });
                result.dialog({
                    width: 600,
                    closeText: "×",
                    modal: true,
                    close: function () { $(this).dialog("destroy"); result.remove(); }
                });
                result.find(".parentid").dropdownlist();
            });
        }
        //删除分类
        function Delete(classifyId) {
            if (confirm("确定要删除吗！！")) {
                $.post('<%=Url.Action("Delete") %>', { "classifyId": classifyId, 'moduleKey': moduleKey, "rnd": Math.random() }, function (result) { location.reload(); });
            }
        }
        $(function () {
            $("#classify").treeview();
        })
    </script>
</asp:Content>
